package com.jk.dailydemo;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Window;

import com.jk.dailydemo.Share.ShareDemoActivity;
import com.jk.dailydemo.camera.MyCamera;

import com.jk.dailydemo.myLibrary.MyLibraryActivity;

import com.jk.dailydemo.progressBar.ChooserActivity;
import com.jk.dailydemo.progressBar.customProgress.CustomProgressActivity;

import com.jk.dailydemo.screenShot.ScreenShot;
import com.jk.dailydemo.theme.Theme;
import com.jk.mylibrarytest.MainActivity_Library;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/5/28.
 */

public class MainActivity extends AppCompatActivity {
    @BindView(R.id.rv_main_list_view)
    RecyclerView mRvMainLitView;
    @BindView(R.id.tb_main)
    Toolbar mTbMain;
    private List<String> mDatas = new ArrayList<>();

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        initToolbar();
        initDatas();
        initRecyclerView();
    }

    private void initToolbar() {
        mTbMain.setTitle("Main");
    }

    private void initDatas() {
        mDatas.add("ScreenShot");
        mDatas.add("Camera");
        mDatas.add("youmengShare");
        mDatas.add("ProgressBar");
        mDatas.add("CustomProgressBar");
        mDatas.add("MyLibrary");

    }

    private void initRecyclerView() {
        mRvMainLitView.setHasFixedSize(true);

        mRvMainLitView.setLayoutManager(new LinearLayoutManager(this));
        MainAdapter mainAdapter = new MainAdapter(mDatas);
        mainAdapter.setOnItemClickListen(onItemClickListen);
        mRvMainLitView.setAdapter(mainAdapter);



    }

    MainAdapter.OnItemClickListen onItemClickListen = new MainAdapter.OnItemClickListen() {
        @Override
        public void onItemClickListen(View v, MainAdapter.ViewHolder holder, int position) {
            switch (position){
                case 0:

                    startActivity(new Intent(MainActivity.this, ScreenShot.class));
                    break;
                case 1:
                    startActivity(new Intent(MainActivity.this, MyCamera.class));

                    break;
                case 2:
                    startActivity(new Intent(MainActivity.this, ShareDemoActivity.class));
                    break;
                case 3:
                    startActivity(new Intent(MainActivity.this, ChooserActivity.class));
                    break;
                case 4:
                    startActivity(new Intent(MainActivity.this, CustomProgressActivity.class));

                    break;
                case 5:
                    startActivity(new Intent(MainActivity.this, MyLibraryActivity.class));
                    break;

            }

        }
    };

    private void changeTheme(Theme theme){
        int primaryColor = theme.getPrimaryColor();
        Window window = getWindow();
        window.setStatusBarColor(primaryColor);
    }

}
